package com.ruoyi.decision.service.impl;

import com.ruoyi.decision.domain.PlanClassification;
import com.ruoyi.decision.mapper.PlanClassificationMapper;
import com.ruoyi.decision.service.IPlanClassificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Locale;
import java.util.UUID;

/**
 * 方案库分类Service业务层处理
 * 
 * @author zbw
 * @date 2022-07-20
 */
@Service
public class PlanClassificationServiceImpl implements IPlanClassificationService 
{
    @Autowired
    private PlanClassificationMapper planClassificationMapper;

    /**
     * 查询方案库分类
     * 
     * @param templateTypeId 方案库分类主键
     * @return 方案库分类
     */
    @Override
    public PlanClassification selectPlanClassificationByTemplateTypeId(String templateTypeId)
    {
        return planClassificationMapper.selectPlanClassificationByTemplateTypeId(templateTypeId);
    }

    /**
     * 查询方案库分类列表
     * 
     * @param planClassification 方案库分类
     * @return 方案库分类
     */
    @Override
    public List<PlanClassification> selectPlanClassificationList(PlanClassification planClassification)
    {
        return planClassificationMapper.selectPlanClassificationList(planClassification);
    }

    /**
     * 新增方案库分类
     * 
     * @param planClassification 方案库分类
     * @return 结果
     */
    @Override
    public int insertPlanClassification(PlanClassification planClassification)
    {
        String templateTypeId = UUID.randomUUID().toString().toLowerCase(Locale.ROOT).replace("-","");
        planClassification.setTemplateTypeId(templateTypeId);
        return planClassificationMapper.insertPlanClassification(planClassification);
    }

    /**
     * 修改方案库分类
     * 
     * @param planClassification 方案库分类
     * @return 结果
     */
    @Override
    public int updatePlanClassification(PlanClassification planClassification)
    {
        return planClassificationMapper.updatePlanClassification(planClassification);
    }

    /**
     * 批量删除方案库分类
     * 
     * @param templateTypeIds 需要删除的方案库分类主键
     * @return 结果
     */
    @Override
    public int deletePlanClassificationByTemplateTypeIds(String[] templateTypeIds)
    {
        return planClassificationMapper.deletePlanClassificationByTemplateTypeIds(templateTypeIds);
    }

    /**
     * 删除方案库分类信息
     * 
     * @param templateTypeId 方案库分类主键
     * @return 结果
     */
    @Override
    public int deletePlanClassificationByTemplateTypeId(String templateTypeId)
    {
        return planClassificationMapper.deletePlanClassificationByTemplateTypeId(templateTypeId);
    }
}
